package view.item
{
	import control.manager.MapManager;
	
	import data.ExitsData;
	import data.MapData;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.geom.Point;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.text.TextFormatAlign;

	/**
	 * 传送点 
	 * @author leo
	 * 
	 */	
	public class ExitsView extends Sprite
	{
		private var txtName :TextField;
		private var exitsData :ExitsData;
		private var mapData :MapData;
		
		public var mc :MovieClip;
		public function ExitsView(exitsData :ExitsData,mapData :MapData)
		{
			super();
			this.exitsData = exitsData;
			this.mapData = mapData;
			this.graphics.beginFill(0xff0000);
			this.graphics.drawRect(0,0,50,50);
			this.graphics.endFill();
			
			var w :int = mapData.mapWalkGapWidth;
			var h :int = mapData.mapWalkGapHeight;
			var tx :int = exitsData.exitsPoint.x;
			var ty :int = exitsData.exitsPoint.y;
			var p :Point = MapManager.instance.getPixelPoint(w,h,tx,ty);
			this.x = p.x - 50;
			this.y = p.y - 50;
			
			
			this.txtName = new TextField();
			this.txtName.width = 50;
			this.txtName.height = 50;
			this.txtName.text = exitsData.exitsName;
			this.txtName.selectable = this.txtName.mouseEnabled = false;
			var txtFormat :TextFormat = new TextFormat();
			txtFormat.size = 16;
			txtFormat.align = TextFormatAlign.CENTER;
			this.txtName.defaultTextFormat = txtFormat;
			this.addChild(this.txtName);
		}
		
		public function getExitsData():ExitsData
		{
			return this.exitsData;
		}
		
		
	}
}